<script setup>
import { defineProps,defineEmits } from 'vue'

const props = defineProps({
  name: {
    type: String,
    required: true
  }
})
const emit = defineEmits(['greet'])
function sendGreeting() {
  emit('greet', `你好，${props.name}!`)
}
</script>

<template>
  <h1>欢迎来到我的 Vue 3 应用, {{ name }}!</h1>
  <button @click="sendGreeting">点击我</button>
  <slot></slot>
</template>

<style scoped>
h1 {
  color: blue;
}
</style>